package com.tj.bigdata.syncblock.producer;

import org.springframework.kafka.support.SendResult;
import org.springframework.util.concurrent.ListenableFutureCallback;

/**
 * @author guoch
 */
public class CallBackService implements ListenableFutureCallback<SendResult<String, String>> {

    @Override
    public void onFailure(Throwable ex) {
        System.out.println("发送消息失败：" + ex.getMessage());
    }

    @Override
    public void onSuccess(SendResult<String, String> result) {
        System.out.println("发送消息成功：" + result.getRecordMetadata().topic() + "-"
                + result.getRecordMetadata().partition() + "-" + result.getRecordMetadata().offset());
    }

}
